﻿using System;
using ControlLibrary;

namespace ControlLibrarySample
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if(this.IsPostBack == false)
            {
                Person person = new Person();
                person.Name = "Murilo";
                person.Surname = "Gomes";

                this.Session.Add("Person", person);
            }

            this.txtName.DataBindings.Add("Text", this.Session["Person"], "Name");
            this.txtSurname.DataBindings.Add("Text", this.Session["Person"], "Surname");

            this.ExecuteDataBind();
        }

        protected void btnOK_Click(object sender, EventArgs e)
        {
            this.ExecuteDataBind();
            this.Response.Redirect("Page1.aspx");
        }
    }
}
